home *** CD-ROM | disk | FTP | other *** search
- Path: locutus.rchland.ibm.com!usenet
- From: Philip Staite <pstaite+@rchland.ibm.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Virtual Base Class
- Date: Wed, 13 Mar 1996 07:48:38 -0600
- Organization: IBM Rochester, MN
- Message-ID: <3146D236.41C6@rchland.ibm.com>
- References: <313F98D0.102E@ucla.edu> <4i1k92$3n8@apoll.informatik.uni-bonn.de>
- NNTP-Posting-Host: powertool.rchland.ibm.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; AIX 1)
-
- Roland Schregle wrote:
- >
- > Dennis Rahaman (dennisr@ucla.edu) wrote:
- > : This is what I want to do:
- >
- > : a
- > : / \
- > : b c
- > : \ /
- > : d
- >
-
- <edited>
-
- > I have the same problem! Somebody suggested the following (in terms of the
- > above egg sample):
- >
- > void f()
- > {
- > a a1;
- > d* pd = (d*)(void*)&a1;
- > }
- >
- > I haven't tried this yet. C'mon you C++ cracks out there!!! :)
-
- No no no NO!
-
- An 'a' is _NOT_ a 'd' -- therefore casting the address of an a object to
- be a pointer to a d object is just plain wrong, probably immoral, and
- maybe even fattening.
-
- Think for a minute, you really don't have a d object there, just an a
- object. It would be different if it really was a d object that was
- given to this code via an a*... Then the cast would make more sense.
-
- --
-
- Phil Staite, (507) 253-2529, team OS/2
- internet: pstaite@vnet.ibm.com internal: pstaite@rchland
-